{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "synthetic-spray",
   "metadata": {},
   "outputs": [],
   "source": [
    "a,b = [1,2]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "photographic-airfare",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/subdomain-visit-count\n",
    "\n",
    "\n",
    "Runtime: 56 ms, faster than 41.53% of Python3 online submissions for Subdomain Visit Count.\n",
    "Memory Usage: 14.4 MB, less than 46.95% of Python3 online submissions for Subdomain Visit Count.\n",
    "\n",
    "\n",
    "\n",
    "```python\n",
    "class Solution:\n",
    "    def subdomainVisits(self, cpdomains: List[str]) -> List[str]:\n",
    "        #6:27\n",
    "        global_counter = dict()\n",
    "        for eachOne in cpdomains:\n",
    "            count, domain = eachOne.split(\" \")\n",
    "            parts = domain.split(\".\")\n",
    "            subdomains = [\".\".join(parts[index:]) for index, _ in enumerate(parts)]\n",
    "            for subdomain in subdomains:\n",
    "                if subdomain in global_counter.keys():\n",
    "                    global_counter[subdomain] += int(count)\n",
    "                else:\n",
    "                    global_counter[subdomain] = int(count)\n",
    "        return [\" \".join([str(item[1]), item[0]]) for item in global_counter.items()]\n",
    "        #6:36\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "coupled-vegetation",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
